// shell script with shelljs
const shell = require("shelljs");
const path = require("path");

const {npm_package_version, http_proxy} = process.env; 

const image = `repchain_block_courier:${npm_package_version}`;

shell.echo(`Building ${image} docker image`);
shell.exec(`docker build --build-arg http_proxy="${http_proxy}" -t "${image}" -f ../../Dockerfile ../..`);
shell.echo("Build Done");
shell.exec(`cd ${__dirname}`);
// Generate release file
const releaseFilePath = path.join(__dirname, ".release");
shell.exec(`echo "version=${npm_package_version}" > ${releaseFilePath}`);
